﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ParserCore;

namespace ParserCore
{
    public class ParsingEngine
    {
        public Statement Parse(string expression, bool scriptfile = false)
        {
            var scanner = new Scanner();
            var parser = new Parser(scanner);

            scanner.Reset();
            parser.Reset();

            scanner.ScriptFile = scriptfile;

            scanner.SetSource(expression + "\n", 0);

            scanner.LexerDebug = true;
            //parser.ParserDebug = true;

            var parserResult = parser.Parse();

            var statement =  parser.StatementTree;

            return statement;
        }
    }
}
